package simple12;

import simple12.factory.AppleFactory;
import simple12.factory.BananaFactory;
import simple12.factory.OrangeFactory;
import simple12.fruit.Fruit;
import simple12.template.OnLineShopping;
import simple12.template.ShoppingCart;

import java.util.ArrayList;
import java.util.List;

/**
 * 模板方法模式
 */
public class Simple {
    public static void main(String[] args) {
        List<Fruit> products = new ArrayList<>();

        products.add(new AppleFactory().getFruit());
        products.add(new OrangeFactory().getFruit());
        products.add(new BananaFactory().getFruit());

        ShoppingCart cart = new OnLineShopping(products);
        cart.submitOrder();
    }
}
